"""应用入口."""

import os

from app import create_app
from config import get_config


config_name = os.getenv("FLASK_CONFIG", "development")
config = get_config(config_name)
app = create_app(config_name)


if __name__ == "__main__":
    print("=" * 60)
    print("ERP Mock Server 启动中…")
    print("=" * 60)
    print("核心接口:")
    print("   GET  /iuap-api-auth/open-auth/selfAppAuth/base/v1/getAccessToken  # 认证 Token")
    print("   POST /iuap-api-gateway/yonbip/mfg/productionorder/list           # 生产订单列表")
    print("   GET  /iuap-api-gateway/yonbip/mfg/productionorder/detail          # 订单详情查询")
    print("   POST /iuap-api-gateway/yonbip/mfg/finishedreport/new/save          # 完工报告保存")
    print("   POST /iuap-api-gateway/yonbip/QMS_QIT/checkapply/list             # 检验申请列表")
    print("   GET  /iuap-api-gateway/yonbip/QMS_QIT/checkapply/detail           # 检验申请详情")
    print("   POST /iuap-api-gateway/yonbip/QMS_QIT/inspectorder/save           # 检验单保存")
    print("   POST /iuap-api-gateway/yonbip/scm/stock/QueryCurrentStocksByCondition # 现存量查询")
    print("   POST /iuap-api-gateway/yonbip/scm/materialout/mergeSourceData/save    # 材料出库保存")
    print("=" * 60)
    print(f"访问地址: http://{config.HOST}:{config.PORT}")
    print("认证方式: Access Token")
    print("=" * 60)

    app.run(host=config.HOST, port=config.PORT, debug=config.DEBUG)

